﻿package mortal.game.view.copy.sixBoss.utils
{
    import flash.utils.*;
    import mortal.game.view.copy.QuestionCopy.data.*;
    import mortal.game.view.copy.sixBoss.data.*;

    public class SixBossUtil extends Object
    {
        public static var HighestDamage:int;
        private static var _bossRankRewardDic:Dictionary = new Dictionary();

        public function SixBossUtil()
        {
            return;
        }// end function

        private static function initRewardInfo(param1:int) : void
        {
            var _loc_5:SixBossOutPutRewardInfo = null;
            var _loc_2:* = QuestionCopyConfig.instance().getRewardsByTypeAndTimes(7, param1);
            var _loc_3:Array = [];
            var _loc_4:int = 0;
            while (_loc_4 < _loc_2.length)
            {
                
                _loc_5 = new SixBossOutPutRewardInfo();
                _loc_5.minRank = _loc_2[_loc_4].scoreMin;
                _loc_5.maxRank = _loc_2[_loc_4].scoreMax;
                _loc_5.itemCode = int(_loc_2[_loc_4].itemRewards.split("#")[0]);
                _loc_5.itemAmount = int(_loc_2[_loc_4].itemRewards.split("#")[1]);
                _loc_3.push(_loc_5);
                _loc_4++;
            }
            _bossRankRewardDic[param1] = _loc_3;
            return;
        }// end function

        public static function getRankRewardByRank(param1:int, param2:int) : SixBossOutPutRewardInfo
        {
            var _loc_4:SixBossOutPutRewardInfo = null;
            var _loc_3:* = _bossRankRewardDic[param1] as Array;
            if (_loc_3 == null)
            {
                initRewardInfo(param1);
            }
            _loc_3 = _bossRankRewardDic[param1] as Array;
            for each (_loc_4 in _loc_3)
            {
                
                if (param2 >= _loc_4.minRank && param2 <= _loc_4.maxRank)
                {
                    return _loc_4;
                }
            }
            return null;
        }// end function

    }
}
